﻿using System;
using System.Collections.Generic;
using System.Text;

using System.Data.SqlClient;

using System.Data;
using MyHotel_DTO;
using MyHotel_Common;

namespace MyHotel_DAO
{
    public class BaoCaoMatDoDAO : DAO
    {
        protected override object createObjectFromDatarow(DataRow row)
        {
            BaoCaoMatDo phong_phieuthue = new BaoCaoMatDo();
            phong_phieuthue.TenPhong = row["TenPhong"].ToString();
            phong_phieuthue.SoNgayThue = Convert.ToInt32(row["SoNgayThue"]);
            phong_phieuthue.TiLe = Convert.ToDouble(row["TiLe"]);
            return phong_phieuthue;
        }
        
        public List<BaoCaoMatDo> getListPhong_PhieuThue_SoNgayThueByThang(int thang)
        {
            string nameProc = "baocaomatdophong";
            SqlParameter para = new SqlParameter("@thang", thang);
            DataTable dt = DataProvider.executeStoreProcedureQuery(nameProc, para);
            return getListFromDataTable<BaoCaoMatDo>(dt);
        }
        public List<BaoCaoMatDo> getListPhong_PhieuThue_SoNgayThue()
        {
            string nameProc = "baocaomatdophong_all";
            DataTable dt = DataProvider.executeStoreProcedureQuery(nameProc, null);
            return getListFromDataTable<BaoCaoMatDo>(dt);
        }
    }
}
